import Vue from 'vue'
import Router from 'vue-router'
import index from "../components/Index.vue";
import List from "../components/user/List.vue";
import VueRouter from "vue-router";

Vue.use(Router);

// 解决NavigationDuplication问题
let originPush = Router.prototype.push;
VueRouter.prototype.push = function (location, resolve, reject) {
  if (resolve && reject) {
    originPush.call(this, location, resolve, reject);
  } else {
    originPush.call(this, location, () => {
    }, () => {
    });
  }
};
export default new Router({
  routes: [
    {
      path: '/',
      redirect: {name: 'Index'} //重定向也可以使用组件名进行配置
    },
    {
      path: '/index',
      name: 'Index',
      component: index
    },
    {
      path: '/users',
      name: 'List',
      component: List
    },
  ]
})
